﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace DA
{
    public class RapDA:BaseConnection
    {
         public SqlDataAdapter danhSachRapAdapter { set; get; }
         public RapDA()
         {
          
         }
         public DataSet timKiemRap(string maRap)
         {
             DataSet ds = new DataSet();
             String sqlStatement = "";
             sqlStatement = "SELECT MaRap, TenRap, DienGiai, SoLuong, SoLuongDangSuDung, HinhAnh, KichThuoc, GhiChu";
             sqlStatement += " FROM Rap";
             sqlStatement += " WHERE MaRap = '" + maRap + "'";

             openConnect();

             SqlCommand cmd = new SqlCommand(sqlStatement, con);
             danhSachRapAdapter = new SqlDataAdapter(cmd);
             danhSachRapAdapter.SelectCommand = cmd;
             SqlCommandBuilder sqlBuilder = new SqlCommandBuilder(danhSachRapAdapter);
             danhSachRapAdapter.Fill(ds, "Rap");
             closeConnect();
             return ds;        
         }
    }
}
